package com.groupbuying.store.controller.forManage;

import com.groupbuying.store.constants.CommonConstants;
import com.groupbuying.store.constants.StoreConstants;
import com.groupbuying.store.domain.StoreMainInfoDO;
import com.groupbuying.store.dto.forManage.AccountDTO;
import com.groupbuying.store.dto.forManage.do2dto.AccountConvert;
import com.groupbuying.store.pojo.FinanceConstant;
import com.groupbuying.store.pojo.StoreMainInfoEnum;
import com.groupbuying.store.service.StoreMainInfoService;
import com.groupbuying.store.service.StoreShopService;
import com.groupbuying.store.utils.PageUtils;
import com.groupbuying.store.utils.Query;
import com.groupbuying.store.utils.R;
import com.groupbuying.store.connector.SysconfigFeign;
import com.groupbuying.store.service.StoreAccountService;
import com.groupbuying.store.service.forManage.StoreRoleService;
import com.groupbuying.store.utils.apiresult.ApiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.POST;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 服务商门店管理
 * @author groupbuying
 */
@RequestMapping("/storeManage")
@RestController
public class StoreShopManageController extends BaseController {
    @Autowired
    StoreAccountService storeAccountService;
    @Autowired
    StoreRoleService storeRoleService;
    @Autowired
	SysconfigFeign sysconfigFeign;
    @Autowired
    StoreMainInfoService storeMainInfoService;

    /**
     * 获取地区列表
     */
    @GetMapping("/getAreaList")
    R getAreaList(){
        return sysconfigFeign.getAreaList(new HashMap<>());
    }

    /**
     * 获取O2O分类
     */
    @GetMapping("/getO2OKindList")
    R getO2OKindList(){
        return sysconfigFeign.getO2OKindList(new HashMap<>());
    }


    /**
     * 从管理后台分页获取商户列表 条件查询
     * @param params
     * @return
     */
    @GetMapping("/getListByPage")
    public R getListByPage(@RequestParam Map<String, Object> params) {
        return storeMainInfoService.getListByPage(params);
    }

    /**
     * 财务平台获取商户审核管理列表
     * @param params
     * @return
     */
    @GetMapping("/getListByPageInFinance")
    public R getListByPageInFinance(@RequestParam Map<String, Object> params){
        return storeMainInfoService.getListByPageInFinance(params);

    }


    /**
     * 审核商户门店
     * @param params
     * @return
     */
    @GetMapping("/auditStoreShop")
    public R auditStoreShop(@RequestParam Map<String, Object> params){
        return storeMainInfoService.auditStoreShop(params);
    }



    /**
     * 门店详情
     * @return
     */
    @GetMapping("/storeShopDetail")
    public R storeShopDetail(@RequestParam Map<String, Object> params){
        return storeMainInfoService.storeShopDetail(params);
    }

    /**
     * 管理商户门店
     * @param params
     * @return
     */
    @GetMapping("/getListByManagePage")
    public R getListByManagePage(@RequestParam Map<String, Object> params){
        return storeMainInfoService.getListByManagePage(params);
    }
    /**
     * 获取导出的商户管理列表
     * @param params
     * @return
     */
    @GetMapping("/getExportStoreMangeList")
    public R getExportStoreMangeList(@RequestParam Map<String, Object> params){
        return storeMainInfoService.getExportStoreMangeList(params);
    }

    /**
     * 审核商户门店
     * @param params
     * @return
     */
    @GetMapping("/freezeOrUnfreezeStoreShop")
    public R freezeOrUnfreezeStoreShop(@RequestParam Map<String, Object> params){
        return storeMainInfoService.freezeOrUnfreezeStoreShop(params);
    }


    /**
     * 门店运营人员获取
     * @param params
     * @auther zmlmagic
     */
    @GetMapping("/getStoreOperList")
    public R getStoreOperList(@RequestParam Map<String, Object> params){
        return storeMainInfoService.getStoreOperList(params);
    }

    /**
     * 门店运营人员获取
     * @param params
     * @auther zmlmagic
     */
    @PostMapping("/setStoreOper")
    public R setStoreOper(@RequestBody Map<String, Object> params){
        return storeMainInfoService.setStoreOper(params);
    }

    /**
     * 通过门店编号--编辑费率
     */
    @PostMapping("/setRate")
    public ApiResult setRate(@RequestBody Map<String, Object> params){
        return storeMainInfoService.setRate(params);
    }
}
